package co.fitstart.entity.product;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import com.alibaba.fastjson.annotation.JSONField;
import com.demo2do.core.format.PersistentFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * @author mohanlan
 *
 */
@Entity
@Table(name = "product_category")
@PersistentFormat
@JsonIgnoreProperties(value={"hibernate_lazy_initializer","handler","fieldHandler"})
public class ProductCategory {

    @Id
    @GeneratedValue
    private Long id;

    /** 名称 */
    private String name;

    private String alias;

    /** 产品封面 */
    private String cover;

    /** 产品类型 */
    @Enumerated(EnumType.STRING)
    private ProductType type;

    @Column(name = "is_disabled")
    @JSONField(serialize = false)
    private boolean disabled;

    /**
     * The default constructor
     */
    public ProductCategory() {

    }

    /**
     * @param cover
     * @return
     */
    public ProductCategory editCover(String cover) {
        this.cover = cover;
        return this;
    }

    /**
     *
     * @return
     */
    public ProductCategory disable() {
        this.disabled = true;
        return this;
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @return the alias
     */
    public String getAlias() {
        return alias;
    }

    /**
     * @return the cover
     */
    public String getCover() {
        return cover;
    }

    /**
     * @return the type
     */
    public ProductType getType() {
        return type;
    }

    /**
     * @return the disabled
     */
    public boolean isDisabled() {
        return disabled;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @param alias the alias to set
     */
    public void setAlias(String alias) {
        this.alias = alias;
    }

    /**
     * @param cover the cover to set
     */
    public void setCover(String cover) {
        this.cover = cover;
    }

    /**
     * @param type the type to set
     */
    public void setType(ProductType type) {
        this.type = type;
    }

    /**
     * @param disabled the disabled to set
     */
    public void setDisabled(boolean disabled) {
        this.disabled = disabled;
    }
}
